﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Model.ViewModels.RoomCrudAdminVm>" %>
<%@ Import Namespace="Web.Helpers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Prostorije
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Pregled prostorija</h2>

    <table>
        <tr>            
            <th>
                Id
            </th>
            <th>
                Grupa
            </th>
            <th>
                Oznaka
            </th>
            <th>
                Tip
            </th>
            <th>
                Naziv
            </th>
            <th>
                Površina
            </th>
            <th></th>
        </tr>

    <% foreach (var item in Model.Rooms) { %>
    
        <tr>            
            <td>
                <%: item.Id %>
            </td>
            <td>
                <%: item.Group %>
            </td>
            <td>
                <%: item.Mark %>
            </td>
            <td>
                <%: item.Type %>
            </td>
            <td>
                <%: item.Name %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.Area) %>
            </td>
            <td>
                <%: Html.ActionLink("Uredi", "EditRoom", new { id = ViewData["ApartmentId"], roomsNumberId = item.Id })%> |                
                <%: Html.ActionLink("Izbriši", "DeleteRoom", new { id = ViewData["ApartmentId"], roomsNumberId = item.Id })%>
            </td>
        </tr>
    
    <% } %>

    </table>

    <br />
    <br />
    <hr />

    <h2>Nova prostorija</h2>

    <% Html.EnableClientValidation(); %>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>

        <fieldset>
            <legend>Forma za unos prostorije</legend>
            
            <div class="editor-label">
                <%: Html.Label("Grupa") %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.RoomGroup) %>
                <%: Html.ValidationMessageFor(model => model.RoomGroup) %>
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Oznaka") %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Mark) %>
                <%: Html.ValidationMessageFor(model => model.Mark) %>
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Tip") %>
            </div>
            <div class="editor-field">
                <%: Html.EnumDropDownListFor(model => model.Type, "-- odaberite tip sobe --", new {} )%>
                <%: Html.ValidationMessageFor(model => model.Type) %>
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Naziv") %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Name) %>                
            </div>
            
            <div class="editor-label">
                <%: Html.Label("Površina") %>
            </div>
            <div class="editor-field">
                <%: Html.TextBoxFor(model => model.Area) %>
                <%: Html.ValidationMessageFor(model => model.Area) %>
            </div>
            
            <p>
                <input type="submit" value="Spremi prostoriju" />
            </p>
        </fieldset>

    <% } %>    

</asp:Content>

